package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "aead_util",
    srcs = ["aead_util.cc"],
    hdrs = ["aead_util.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        "//util:errors",
        "//util:statusor",
        "@boringssl//:crypto",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/status",
    ],
)

cc_library(
    name = "wycheproof_aead",
    testonly = 1,
    srcs = ["wycheproof_aead.cc"],
    hdrs = ["wycheproof_aead.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        "//subtle:wycheproof_util",
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "ssl_aead",
    srcs = ["ssl_aead.cc"],
    hdrs = ["ssl_aead.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":aead_util",
        "//internal:err_util",
        "//internal:ssl_unique_ptr",
        "//internal:util",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "@boringssl//:crypto",
        "@com_google_absl//absl/cleanup",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
    ],
)

cc_library(
    name = "cord_aes_gcm_boringssl",
    srcs = ["cord_aes_gcm_boringssl.cc"],
    hdrs = ["cord_aes_gcm_boringssl.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":aead_util",
        "//aead:cord_aead",
        "//internal:ssl_unique_ptr",
        "//subtle:random",
        "//subtle:subtle_util",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "@boringssl//:crypto",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings:cord",
    ],
)

cc_library(
    name = "zero_copy_aead",
    hdrs = ["zero_copy_aead.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "mock_zero_copy_aead",
    testonly = 1,
    hdrs = ["mock_zero_copy_aead.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":zero_copy_aead",
        "//util:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest",
    ],
)

cc_library(
    name = "aead_from_zero_copy",
    srcs = ["aead_from_zero_copy.cc"],
    hdrs = ["aead_from_zero_copy.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":zero_copy_aead",
        "//:aead",
        "//subtle:subtle_util",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
    ],
)

cc_library(
    name = "zero_copy_aead_wrapper",
    srcs = ["zero_copy_aead_wrapper.cc"],
    hdrs = ["zero_copy_aead_wrapper.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":zero_copy_aead",
        "//:aead",
        "//:crypto_format",
        "//:primitive_set",
        "//:primitive_wrapper",
        "//subtle:subtle_util",
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "zero_copy_aes_gcm_boringssl",
    srcs = ["zero_copy_aes_gcm_boringssl.cc"],
    hdrs = ["zero_copy_aes_gcm_boringssl.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        ":aead_util",
        ":ssl_aead",
        ":zero_copy_aead",
        "//internal:util",
        "//subtle:random",
        "//subtle:subtle_util",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "key_gen_config_v0",
    srcs = ["key_gen_config_v0.cc"],
    hdrs = ["key_gen_config_v0.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        "//:key_gen_configuration",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_eax_key_manager",
        "//aead:aes_gcm_key_manager",
        "//aead:aes_gcm_siv_key_manager",
        "//aead:xchacha20_poly1305_key_manager",
        "//internal:key_gen_configuration_impl",
        "//util:status",
        "@com_google_absl//absl/memory",
    ],
)

cc_library(
    name = "config_v0",
    srcs = ["config_v0.cc"],
    hdrs = ["config_v0.h"],
    include_prefix = "tink/aead/internal",
    deps = [
        "//:configuration",
        "//aead:aead_wrapper",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_eax_key_manager",
        "//aead:aes_gcm_key_manager",
        "//aead:aes_gcm_siv_key_manager",
        "//aead:xchacha20_poly1305_key_manager",
        "//internal:configuration_impl",
        "//util:status",
        "@com_google_absl//absl/memory",
    ],
)

cc_test(
    name = "cord_aes_gcm_boringssl_test",
    size = "small",
    srcs = ["cord_aes_gcm_boringssl_test.cc"],
    data = ["//testvectors:aes_gcm"],
    deps = [
        ":cord_aes_gcm_boringssl",
        "//subtle:aes_gcm_boringssl",
        "//subtle:wycheproof_util",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "@boringssl//:crypto",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:cord",
        "@com_google_absl//absl/strings:cord_test_helpers",
        "@com_google_googletest//:gtest_main",
        "@rapidjson",
    ],
)

cc_test(
    name = "aead_util_test",
    size = "small",
    srcs = ["aead_util_test.cc"],
    deps = [
        ":aead_util",
        "//util:test_matchers",
        "@boringssl//:crypto",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "zero_copy_aead_wrapper_test",
    srcs = ["zero_copy_aead_wrapper_test.cc"],
    deps = [
        ":mock_zero_copy_aead",
        ":zero_copy_aead_wrapper",
        "//subtle:subtle_util",
        "//util:test_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "zero_copy_aes_gcm_boringssl_test",
    srcs = ["zero_copy_aes_gcm_boringssl_test.cc"],
    data = ["//testvectors:aes_gcm"],
    deps = [
        ":wycheproof_aead",
        ":zero_copy_aead",
        ":zero_copy_aes_gcm_boringssl",
        "//subtle:subtle_util",
        "//util:statusor",
        "//util:test_matchers",
        "@boringssl//:crypto",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "aead_from_zero_copy_test",
    srcs = ["aead_from_zero_copy_test.cc"],
    deps = [
        ":aead_from_zero_copy",
        ":mock_zero_copy_aead",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ssl_aead_test",
    srcs = ["ssl_aead_test.cc"],
    data = [
        "//testvectors:aes_gcm",
        "//testvectors:aes_gcm_siv",
        "//testvectors:chacha20_poly1305",
    ],
    deps = [
        ":ssl_aead",
        ":wycheproof_aead",
        "//internal:fips_utils",
        "//internal:ssl_util",
        "//subtle:subtle_util",
        "//util:secret_data",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ssl_aead_large_inputs_test",
    size = "enormous",
    srcs = ["ssl_aead_large_inputs_test.cc"],
    deps = [
        ":ssl_aead",
        "//config:tink_fips",
        "//internal:ssl_util",
        "//internal:util",
        "//subtle:subtle_util",
        "//util:secret_data",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "config_v0_test",
    srcs = ["config_v0_test.cc"],
    deps = [
        ":config_v0",
        ":key_gen_config_v0",
        "//:aead",
        "//:configuration",
        "//:key_gen_configuration",
        "//:keyset_handle",
        "//aead:aead_key_templates",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_eax_key_manager",
        "//aead:aes_gcm_key_manager",
        "//aead:aes_gcm_siv_key_manager",
        "//aead:xchacha20_poly1305_key_manager",
        "//internal:configuration_impl",
        "//internal:key_gen_configuration_impl",
        "//internal:key_type_info_store",
        "//internal:keyset_wrapper_store",
        "//internal:ssl_util",
        "//proto:tink_cc_proto",
        "//util:statusor",
        "//util:test_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)
